#include "kdcmediaplayerconfigpage.h"

#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QLabel>

#include <KLocale>

#include "kdcmediaplayerconfig.h"

KDCMediaPlayerConfigPage::KDCMediaPlayerConfigPage( QWidget * parent ) : KDCConfigPageInterface( parent )
{
	kcfg_VideoDriver = new KComboBox( this );
	QStringList drivers = KDCMediaPlayerConfigPage::videoDrivers();
	QStringList::const_iterator it;
	for ( it = drivers.constBegin(); it != drivers.constEnd(); ++it )
		kcfg_VideoDriver->addItem( *it, *it );

	QHBoxLayout *hLayout_1 = new QHBoxLayout;
	hLayout_1->addWidget( new QLabel( i18n("Default video driver:") ) );
	hLayout_1->addWidget( kcfg_VideoDriver );

	QVBoxLayout *mainLayout = new QVBoxLayout( this );
	mainLayout->addLayout( hLayout_1 );
	mainLayout->addStretch();
}

KDCMediaPlayerConfigPage::~KDCMediaPlayerConfigPage()
{

}

void KDCMediaPlayerConfigPage::load()
{
	kcfg_VideoDriver->setCurrentIndex( kcfg_VideoDriver->findText( KDCMediaPlayerConfig::videoDriver() ) );
}

void KDCMediaPlayerConfigPage::save()
{
	KDCMediaPlayerConfig::setVideoDriver( kcfg_VideoDriver->currentText() );
}

QStringList KDCMediaPlayerConfigPage::videoDrivers()
{
	return QStringList() << "xv" << "x11" << "gl" << "gl2" "sdl" << "directfb";
}
